// admin/pages/work/work.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    height:wx.getSystemInfoSync().windowHeight-20,
    lines:[{
      nums:30,
      uid:11,
      st: true
    },
    {
      nums:30,
      uid:12,
      st:true
    }
  ],
  mylines:[
  {
    nums:30,
    uid:14,
    show:false
  },
  {
    nums:30,
    uid:15,
    show:true
  }],
    colors:["Coral","CornflowerBlue","GoldenRod","HotPink","OldLace","Orchid","YellowGreen"]
  },
  shuaxin(){
    this.onLoad()
  },
  overwork(e){
    var that = this
    var id = e.currentTarget.dataset.id
    getApp().helper({
      url: getApp().globalData.urlpath + '/weixin/over',
      data: {
        openid: getApp().globalData.uid,
        other: id
      },
      success(res) {
        var e = res.data
        if(res.data.ret == 'F1'){
          that.onLoad()
        }
      },
      fail() {
        wx.showToast({
          title: '连接服务器失败',
          image: '/static/error.png',
          duration: 1500
        });
      }
    });
  },
  clickme(e){
    var id = e.currentTarget.dataset.id
    var that = this
    getApp().helper({
      url: getApp().globalData.urlpath + '/weixin/gowork',
      data: {
        openid: getApp().globalData.uid,
        other: id
      },
      success(res) {
        var e = res.data
        if(res.data.ret == 'F1'){
          that.onLoad()
        }
      },
      fail() {
        wx.showToast({
          title: '连接服务器失败',
          image: '/static/error.png',
          duration: 1500
        });
      }
    });
    
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad() {
    var that = this
    getApp().helper({
      url: getApp().globalData.urlpath + '/weixin/adminwork',
      data: {
        openid: getApp().globalData.uid,
        power: getApp().globalData.power
      },
      success(res) {
        var e = res.data
        if(res.data.ret == 'F1'){
          that.setData({
            lines:e.lines,
            mylines:e.mylines
          })
        }
      },
      fail() {
        wx.showToast({
          title: '连接服务器失败',
          image: '/static/error.png',
          duration: 1500
        });
      }
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})